import CachedVariableManager from '@/store/_cachedVariableManager'
import Event from '@/store/_event'
import type { CartItem } from '@/types/entity/ShoppingCart'
import { UUIDGenerator } from '@/utils/UUID'
import { PageRefVar } from '@/store/_pageData'

export default class ShoppingCartStore {
  public cart = new PageRefVar<CartItem[]>('pages/shop/index', [])
  // 购物车Clear事件
  public shoppingCartRefreshEvent = new Event()
  public specificationsCountPlusOrDownEvent = new Event<CartItem>()
  public clientId = new CachedVariableManager<string>('CLIENT_ID', UUIDGenerator.gen())
}
